﻿using SqlSugar;
using StoreIModels;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using static System.Net.Mime.MediaTypeNames;

namespace StoreRepositorys
{
    /// <summary>
    /// 上下文类
    /// </summary>
    public class MySqlSugarDbcontext
    {
        public readonly ISqlSugarClient db;
        public MySqlSugarDbcontext(ISqlSugarClient DBContext)
        {
            this.db = DBContext;
        }
        public void CreateTable()
        {
            db.DbMaintenance.CreateDatabase();//没有数据库则新建
            db.CodeFirst.SetStringDefaultLength(50).BackupTable().InitTables(new Type[]
            {
               typeof(StoreModel),         //门店表
               typeof(RelationshipStoreModels),        //门店配套设施关系表           
               typeof(SystematicModel),        //分类相册表          
               typeof(PictureModel),        //上传图片表           
               typeof(AftermarketModel),        //售后订单表           
               typeof(DepositRefundsModel)        //押金退款表           
            });
        }

    }
}
 